/**
 * Copyright HNAS Co. Ltd. 
 * All right reserved. 
 *
 *@date 2010-5-22
 *@author 陈建海(jianh_chen)
 * TODO<h4>Description</h4>
 * 
 *
 *@change
 */

package com.myway.dto.logs.domain;

import java.util.HashMap;


/**
 *@author 陈建海(jianh_chen)
 *@description
 *
 * ibeMethod Type
 *
 *@date 2010-5-22
 */
public enum IBEMethodType
{

	/**
	 * 查询航班
	 */
	AV("AV"),
	/**
	 * 预定pnr
	 */
	RESERVEPNR("RESERVEPNR"),
	/**
	 * 出票
	 */
	ISSUETICKET("ISSUETICKET"),
	
	/**
	 * 退票
	 */
	REFUNDTICKET("REFUNDTICKET"),
	
	/**
	 * 提客票信息
	 */
	DETR("DETR"),
	
	/**
	 * NO pnr
	 */
	NOPNR("NOPNR");
	
	/**
	 * Alias name. This is the name which will be stored in database.
	 */
	private final String alias;

	/**
	 * A hash map which keep all the action enum with alias name as key.
	 */
	private static HashMap<String, IBEMethodType> map;

	/**
	 * Construct the hash map at load time
	 */
	static 
	{
		map = new HashMap<String, IBEMethodType>();
		for (IBEMethodType type : IBEMethodType.values()) {
			map.put(type.alias, type);
		}
	}

	IBEMethodType(String alias) 
	{
		this.alias = alias;
	}

	@Override
	public String toString()
	{
		return this.alias;

	}

	/**
	 * Return a <code>Action</code> object holding the value of specified alias name
	 *
	 * @param alias
	 *            the alias name of the type
	 *
	 * @return a <code>Action</code> object holding the value represented by the alias name
	 *         argument
	 */
	public static IBEMethodType valueOfAlias(String alias)
	{
		IBEMethodType type = map.get(alias);

		if (type == null) {
			throw new IllegalArgumentException("Unknown action alias [" + alias + "]");
		}

		return type;
	}

	/**
	 * @return the alias
	 */
	public String getAlias() {
		return this.alias;
	}
}
